<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>按条件显示</title>
</head>
<body>
  <!--模版语法-->
  <div id="app">
    <!-- <ul>
      <li>{{name[0]}}</li>
      <li>{{name[1]}}</li>
      <li>{{name[2]}}</li>
    </ul> -->

    <ul v-if="name.length > 0">
      <li v-for="item in name">{{item}}</li>
    </ul>
    <h2 v-else>当前name没有数据, 请求获取数据后展示</h2>
  </div>
  <script src="../lib/vue.js"></script>
  <script>
    // 使用vue
    const app = Vue.createApp({
      data: function(){
        return {
          message: "hello v-on"
          // , name: ["abc", "cba", "nba"]
          , name: []
        }
      }
      ,methods: {
      }
    }
    )
    // 挂载 
    app.mount("#app")

  </script>

</body>
</html>
